package vld

import (
	sqlc "bp/db/sqlc"
	"bp/internal/util"
)

// IsQualifyType check string is em_qualify_type
func IsQualifyType(v string) (success bool) {
	switch sqlc.EmQualifyType(v) {
	case sqlc.EmQualifyTypeBindMobile, sqlc.EmQualifyTypeAsMember:
		success = true
	}
	return
}

// IsQualifyTypeArray check []string is []em_qualify_type
func IsQualifyTypeArray(v []string, emptyIsValid bool) (success bool) {
	if emptyIsValid && len(v) == 0 {
		success = true
		return
	}
	success = util.AllString(v, func(s string) bool {
		return IsQualifyType(s)
	})
	return
}
